/*******************************************************************
 * Copyright (C) yel_hb-USTC, 2012                                
 *                                                                  
 * FILE NAME             :  MLP.h                                 
 * PRINCIPAL AUTHOR      :  yel_hb                               
 * MODULE NAME           :  MLP                             
 * LANGUAGE              :  C++                                      
 * TARGET ENVIRONMENT    :  windows                                   
 * DATE OF FIRST RELEASE :  2013/1/4                              
 * DESCRIPTION           :  class MLP definition
 ******************************************************************/

/*
 * Revision log:
 *
 * Created by yel_hb,2013/1/4
 *
 */

#ifndef MLP_H     
#define MLP_H    1

#include "dmvector.h"
#include <vector>
using namespace std;

class MLP
{
public:
	MLP ();
	MLP ( int n, int k, double eta );
	bool classify ( const DMVector& X );
	void reset();
	void update ( const DMVector& X, bool inClass );
private:
	void set_hyperplane_weights ( size_t i, DMVector& C, const DMVector& N );
	void MLP::forward ( const DMVector& X );
	void backward ( const DMVector& X, int c );
	vector<DMVector> V;
	DMVector vn;
	DMVector W;
	double wn;
	DMVector Y;
	DMVector Yp;
	double en;
	double z;
	double zp;
	DMVector E;
	double eta;
	int n;
	int k;
};

#endif